package collection_job;

import collection.Point;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class PointDemo {
    public static void main(String[] args) {
        List<Point> list=new ArrayList<>();
        list.add(new Point(4,8));
        list.add(new Point(8,9));
        list.add(new Point(55,2));
        list.add(new Point(44,90));
        list.add(new Point(2,99));
        System.out.println("list原始数据：" + list);

        list.sort(new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return o1.getX()-o2.getX();
            }
        });
        System.out.println("list排序后数据："+list);
    }
}
